package org.pearl.mp.danamic.controller;


import io.seata.spring.annotation.GlobalTransactional;
import org.pearl.mp.danamic.service.AccountTblService;
import org.pearl.mp.danamic.service.OrderTblService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author td
 * @since 2020-01-02
 */
@RestController
@RequestMapping
public class AccountTblController {


    @Autowired
    AccountTblService accountTblService;
    @Autowired
    OrderTblService orderTblService;


    @GlobalTransactional
    @GetMapping("/test")
    public Object test() throws InterruptedException {
        accountTblService.reduceMoney();
        orderTblService.insertOrder();
        return "执行完毕！";
    }
}

